<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: purple;
            margin: 0 auto;
            animation: mydh 3s linear 0s 2;
        }

        div:hover{
            /* background-color: chartreuse; */    /*鼠标放上去会变色*/
            animation-play-state: paused;      /*鼠标放上去会暂停*/
        }
        @keyframes mydh{
            0%{
                width: 200px;
                background-color: red;
            }
            50%{
                width: 400px;
                background-color: aqua;
            }
            100%{
                width: 200px;
                background-color: black;
            }
        }
    </style>
</head>
<body>

    <div></div>
    
</body>
</html>